package com.ycu.jk16.mall.dao.provider;

import org.apache.ibatis.jdbc.SQL;

import com.ycu.jk16.mall.domain.ShoppingCart;

import static com.ycu.jk16.mall.util.common.AndroidMalConstant.SHOPPINGCARTTABLE;

public class ShoppingCartDynaSqlProvider {

	
	// 动态更新
	public String updateShoppingCartOfQuantity(ShoppingCart shoppingCart) {
		return new SQL() {
			{
				UPDATE(SHOPPINGCARTTABLE);
				if (shoppingCart.getId() != null) {
					// SET("数据库字段名", "Java属性名")
					SET(" quantity = #{quantity} ");
				}
				WHERE(" id = #{id} ");
			}
		}.toString();
	}
}
